<?php

/**
 * FILE: index.php 
 * Created on Jul 14, 2012 at 1:42:07 PM 
 * Author: Mr.Vibe 
 * Credits: www.VibeThemes.com
 * Project: WordPress 
 * License: GPLv2
 */

get_header();
$vibe_option=get_option('VibeLivre');
if(is_string($vibe_option))
            $vibe_option=unserialize($vibe_option);

?>

			
			
			
			<!-- Content -->
			<div id="content">
			<?php
                        if($vibe_option['enable_slider']): ?>
                        
				<!-- slider -->
		        <div class="flexslider home-slider">
			<ul class="slides">
                            <?php
                            
                             $the_query = new WP_Query( array( 'post__in' => $vibe_option['slider_posts']) );
                            while ( $the_query->have_posts() ) : $the_query->the_post();
                            ?>
				    <li>
				      <img src="<?php echo get_imagesrc('full');  ?>" alt="<?php the_title(); ?>" />
				      <p class="flex-caption"><?php the_title(); ?> </p>
				    </li>
                                    <?php
                                    endwhile;
                                    wp_reset_postdata();
                                    ?>
			 </ul>
                        </div>
				<div class="shadow-slider"></div>
	        	<!-- ENDS slider -->
                        <?php
                        endif;
                        ?>
	        	
	        	<!-- Headline -->
	        	<div class="headline">
	        		<?php echo $vibe_option['tagline']; ?>
	        	</div>
	        	<!-- ENDS Headline -->
	        	
	        	
	        	
	        	<!-- featured -->
	        	<h1 class="home-block-heading"><?php echo $vibe_option['featured_title']; ?></h1>
	        	<div class="featured">
	        		<?php
                                if($vibe_option['custom_featured'] !='')
                                {
                                    echo $vibe_option['custom_featured'];
                                }else{
                                   foreach($vibe_option['home_featured'] as $page){
                                       $page_data = get_page( $page );
                                       
                                   ?>
                                    <figure>
                                        <?php
                                        $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $page ) );
                                        ?>
                        		<a href="<?php echo $thumbnail_src[0];  ?>" data-rel="prettyPhoto" class="thumb"><img src="<?php echo $thumbnail_src[0];  ?>" alt="<?php echo $page_data->post_title; ?>" /></a>
					 <div>
	        				<a href="<?php echo get_page_link($page); ?>" class="heading"><?php echo $page_data->post_title; ?></a>
		        			 <?php echo substr($page_data->post_content,0,intval($vibe_option['featured_chars'])); ?>
                                                <a href="<?php echo get_page_link($page); ?>"> ..more </a>
                                                </div>
                                    </figure>
                                 <?php
                                   }
                                }
                                
	        		?>
	        		<div class="clearfix"></div>
					        		
	        	</div>
	        	<!-- ENDS featured -->
	        	
	        	
	        	<!-- text-posts -->
	        	<h1 class="home-block-heading"><?php echo $vibe_option['blog_title']; ?></h1>
                        <ul class="text-posts">
                            <?php
                            
                        $the_query = new WP_Query( array( 'category__in' => $vibe_option['home_blog'] ,'posts_per_page' => '6') );
                        while ( $the_query->have_posts() ) : $the_query->the_post();
                        
                        ?>
	        	
	        		<li>
	        			<a href="<?php the_permalink(); ?>" class="heading"><?php the_title(); ?></a>
	        			<?php the_portfolio_excerpt($vibe_option['featured_chars']); ?>
	        		</li>
	        		
	        	<?php
                        endwhile;
                        // Reset Post Data
                        wp_reset_postdata();
                        ?>
	        	</ul>
	        	<!-- ENDS text-posts -->
	        	
	        	
	        	<!-- home-gallery -->
	        	<h1 class="home-block-heading">From the gallery</h1>
	        	<ul class="home-gallery">
                            <?php
                            $the_query = new WP_Query( array( 'post__in' => $vibe_option['home_gallery']) );
                        while ( $the_query->have_posts() ) : $the_query->the_post();
                        
                        ?>
	        	
	        		<li>
                                    <a href="<?php echo get_imagesrc('full');  ?>" data-rel="prettyPhoto" class="thumb">
                                        <img src="<?php echo get_imagesrc('featured');  ?>" alt="<?php the_title(); ?>" />
                                    </a>
                                </li>
	        			
	        		
	        	<?php
                        endwhile;
                        // Reset Post Data
                        wp_reset_postdata();
                        
                        ?>
                        </ul>
	        	<div class="clearfix"></div>	
	        	<!-- ENDS home-gallery -->
				
				
			
			</div>
			<!-- ENDS content -->
			
			<div class="clearfix"></div>
			<div class="shadow-main"></div>
			
			
		</div>
		<!-- ENDS MAIN -->
		
<?php
get_footer();
?>